package com.compass.mobile.ui.activity

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.FragmentTransaction
import com.compass.mobile.R
import com.compass.mobile.databinding.ActivityHomePageBinding
import com.compass.mobile.framework.base.BaseVBActivity
import com.compass.mobile.framework.constant.KEY_DEPARTMENT_CODE
import com.compass.mobile.framework.constant.KEY_DEPARTMENT_ID
import com.compass.mobile.framework.constant.KEY_TYPE
import com.compass.mobile.ui.fragment.DepartmentIntroductionFragment

/**
 * Description： 问诊/预约  科室首页
 * Date:2024/6/3 22:26
 */
class DepartmentIntroductionActivity : BaseVBActivity<ActivityHomePageBinding>() {


    companion object {
        fun start(context: Context, departmentId: String?,departmentCode:String?,comeType:String) {
            val intent = Intent(context, DepartmentIntroductionActivity::class.java)
            intent.putExtra(KEY_DEPARTMENT_ID, departmentId)
            intent.putExtra(KEY_DEPARTMENT_CODE, departmentCode)
            intent.putExtra(KEY_TYPE, comeType)
            context.startActivity(intent)
        }
    }
    private var comeType: String? = null
    private var departmentId: String? = null
    private var departmentCode: String? = null

    private lateinit var departmentIntroductionFragment:DepartmentIntroductionFragment
    override fun initView(savedInstanceState: Bundle?) {
        departmentId=intent.getStringExtra(KEY_DEPARTMENT_ID)
        departmentCode=intent.getStringExtra(KEY_DEPARTMENT_CODE)
        comeType = intent?.getStringExtra(KEY_TYPE)
        departmentIntroductionFragment=DepartmentIntroductionFragment()
        val bundleEx = Bundle()
        bundleEx.putString(KEY_DEPARTMENT_ID, departmentId)
        bundleEx.putString(KEY_DEPARTMENT_CODE, departmentCode)
        bundleEx.putString(KEY_TYPE, comeType)
        departmentIntroductionFragment.arguments = bundleEx

        val fragmentTransaction: FragmentTransaction = supportFragmentManager.beginTransaction()
        fragmentTransaction.replace(R.id.fragmentContainer, departmentIntroductionFragment)
        fragmentTransaction.commit()

    }
}
